<?php
/* @var $this QshiftController */
/* @var $model Qshift */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'qshift-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,)	
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textField($model,'description',array('size'=>35,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'start_time'); ?>
			<?php $this->widget( 'ext.EJuiTimePicker.EJuiTimePicker', array(
			  'model' => $model, 
			  'attribute' => 'start_time',
			  'options' => array(
					'timeOnly' => true,
					'stepMinute' => '15',
			  ),
			  
			  'htmlOptions'=>array(
					'size'=>'6',
			  ),
			  
			)); ?>	
		<?php echo $form->error($model,'start_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'end_time'); ?>
			<?php $this->widget( 'ext.EJuiTimePicker.EJuiTimePicker', array(
			  'model' => $model, 
			  'attribute' => 'end_time',
			  'options' => array(
					'timeOnly' => true,
					'stepMinute' => '15',
			  ),
			  
			  'htmlOptions'=>array(
					'size'=>'6',
			  ),
			  
			)); ?>	
		<?php echo $form->error($model,'end_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'enabled'); ?>
			<?php echo $form->dropDownList($model, 'enabled',
											array('1'=>'Yes',
												  '0'=>'No',
												  ),
											array('empty'=>'','class'=>'dropbinary'));?>			
		<?php echo $form->error($model,'enabled'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'availability'); ?>
			<?php echo $form->dropDownList($model, 'availability',
											array('1'=>'Yes',
												  '0'=>'No',
												  ),
											array('empty'=>'','class'=>'dropbinary'));?>		<?php echo $form->error($model,'availability'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'swap_allowed'); ?>
			<?php echo $form->dropDownList($model, 'swap_allowed',
											array('1'=>'Yes',
												  '0'=>'No',
												  ),
											array('empty'=>'','class'=>'dropbinary'));?>		<?php echo $form->error($model,'swap_allowed'); ?>
	</div>

	
	<?php if(!(Yii::app()->user->restricted)): ?>	
	
		<div class="row">
			<?php echo $form->labelEx($model,'team_id'); ?>
				<?php echo $form->dropDownList($model,'team_id',
											   CHtml::listData(Team::model()->findAll(),
															   'idteam', 
															   'short_name'),	
												array('empty'=>'','class'=>'dropteam',));?>		
			<?php echo $form->error($model,'team_id'); ?>
		</div>

	<?php else:	?>	
		
		<div class="row">
			<?php echo $form->dropDownList($model,'team_id',
											   CHtml::listData(Team::model()->findAll(),
															   'idteam', 
															   'short_name'),	
												array('empty'=>'','class'=>'dropteam','style'=> 'display:none',));?>		
			<?php echo $form->error($model,'team_id'); ?>
		</div>
	
	<?php endif; ?>		
		
	<br>
	<div class="buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->